package com.hfjyz.expert.expertcall.bean;

import java.util.ArrayList;
import java.util.List;

import com.hfjyz.base.entity.CallEntity;
import com.hfjyz.base.entity.ExpertEntity;
import com.hfjyz.base.util.CodeUtil;
import com.hfjyz.call.bean.CallBean;
import com.hfjyz.expert.expert.bean.ExpertBean;
import com.hfjyz.expert.expertcall.entity.ExpertCallEntity;

public class ExpertCallBean extends CallBean {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 3264527583628775170L;
    protected ExpertBean target = null;
    protected final Integer callType = 1;

    public ExpertCallBean() {
    }

    public ExpertCallBean(CallEntity call, ExpertEntity expert) {
        id = call.getId();
        callName = call.getCallName();
        callReason = call.getCallReason();
        callRemark = call.getCallRemark();
        target = new ExpertBean(expert);
        callAim = call.getCallAim();
    }
    
    public ExpertCallBean(ExpertCallEntity call) {
        id = call.getId();
        callName = call.getCallName();
        callReason = call.getCallReason();
        callRemark = call.getCallRemark();
        target = new ExpertBean(call.getTarget());
        callAim = call.getCallAim();
    }

    public Integer getCallType() {
        return callType;
    }

    public ExpertBean getTarget() {
        return target;
    }

    public void setTarget(ExpertBean target) {
        this.target = target;
    }

    @Override
    public List<String> toJsonArray(int index) {
        List<String> result = new ArrayList<String>();
        result.add(String.valueOf(index + 1));
        result.add(target.getIdNo());
        result.add(target.getName());
        result.add(CodeUtil.getSexString(target.getSex()));
        result.add(callName);
        result.add(CodeUtil.getCallAimText(callAim));
        result.add(callReason);
        result.add(callRemark);

        return result;
    }
}
